package a.f.d;

import a.a.qb;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.m;
import a.c.v;
import a.c.w;
import a.c.x;
import a.c.y;
import a.c.z;
import a.f.o;
import a.i.db;
import a.i.mb;

public class i
  extends f
{
  static final boolean p = false;
  private boolean q = false;
  private double r;
  private double s;
  private double t = 10.0D;
  private double u = 2.0D;
  static final double v = 1.E-005D;
  protected x w;
  protected x x;
  private int y = 1;
  mb z = new mb(false);
  mb A = new mb(false);
  mb B = new mb(false);
  mb C = new mb(false);
  mb D = new mb(false);
  mb E = new mb(false);
  mb F = new mb(false);
  mb G = new mb(false);
  mb H = new mb(false);
  mb I = new mb(false);
  mb J = new mb(false);
  mb K = new mb(false);
  public static boolean L;
  
  protected void f()
  {
    this.z.c();
    this.r = Math.max(b(), a());
    if (f.o == 0)
    {
      if (this.r < 1.0D) {
        this.r = 1.0D;
      }
      this.s = ((int)(c() / this.r) * this.r);
      this.w = db.a(new Object[this.l.k()]);
      this.x = db.a(new Object[this.l.k()]);
    }
    this.z.c();
  }
  
  protected void a(bb[] paramArrayOfbb, k paramk)
  {
    int m = f.o;
    int k = f.n;
    this.A.c();
    f();
    b(paramArrayOfbb);
    double d1 = j();
    double d2 = (1.0D / 0.0D);
    int i = 0;
    if (i < this.y) {
      label49:
      if (m == 0)
      {
        if (d1 >= d2) {
          break label239;
        }
        qb.a();
        i++;
        d2 = d1;
      }
    }
    label126:
    do
    {
      int j = 1;
      z localz2;
      do
      {
        do
        {
          if (j >= paramArrayOfbb.length) {
            break;
          }
          localz2 = a(paramArrayOfbb[j], -1);
          a(localz2, -1);
          j++;
          if (m != 0) {
            break label128;
          }
          if (k != 0) {
            break label126;
          }
        } while (k == 0);
      } while (m != 0);
      j = paramArrayOfbb.length - 2;
      do
      {
        do
        {
          if (j < 0) {
            break;
          }
          localz2 = a(paramArrayOfbb[j], 1);
          a(localz2, 1);
          j--;
          if (m != 0) {
            break label177;
          }
          if (k != 0) {
            break label175;
          }
        } while (k == 0);
      } while (m != 0);
      j = 1;
      do
      {
        if (j >= paramArrayOfbb.length - 1) {
          break;
        }
        localz2 = a(paramArrayOfbb[j], 0);
        a(localz2, 0);
        j++;
        if (m != 0) {
          break label236;
        }
        if (k != 0) {
          break label234;
        }
      } while (k == 0);
      i();
      if (m != 0) {
        break label49;
      }
      d1 = j();
      if (k == 0) {
        break;
      }
      qb.a();
      z localz1 = h();
      a(localz1);
      this.A.c();
    } while (m != 0);
    label128:
    label175:
    label177:
    label234:
    label236:
    label239:
    return;
  }
  
  protected void g()
  {
    this.l.a(this.x);
    this.l.a(this.w);
  }
  
  protected boolean a(z paramz)
  {
    int j = f.o;
    int i = f.n;
    this.B.c();
    boolean bool1 = false;
    double[] arrayOfDouble1 = new double[2];
    double[] arrayOfDouble2 = new double[2];
    double[] arrayOfDouble3 = new double[2];
    boolean bool2 = false;
    break label96;
    label37:
    y localy = paramz.h();
    label96:
    label255:
    do
    {
      do
      {
        do
        {
          if (!localy.e()) {
            break label346;
          }
          bb localbb = (bb)localy.j();
          e locale = localbb.m();
          arrayOfDouble1[0] = a(locale, true);
          arrayOfDouble1[1] = a(locale, false);
          Object localObject = localbb.f();
          if (i != 0) {
            break label37;
          }
          if (j != 0) {
            break;
          }
          v localv1 = localbb.f().a();
          if (localv1 != null)
          {
            locale = (e)localv1.c();
            arrayOfDouble2[0] = a(locale, true);
            arrayOfDouble2[1] = a(locale, false);
            arrayOfDouble3[0] = Math.max(arrayOfDouble1[0], arrayOfDouble2[0]);
            arrayOfDouble3[1] = Math.min(arrayOfDouble1[1], arrayOfDouble2[1]);
            if (j != 0) {}
          }
          else
          {
            do
            {
              if (i != 0) {
                break label333;
              }
              if (arrayOfDouble3[1] < arrayOfDouble3[0])
              {
                v localv2 = localv1.b();
                if (j == 0) {
                  if (localv2 != null)
                  {
                    if (j != 0) {
                      break label255;
                    }
                    if (localv2 != localObject)
                    {
                      bool2 |= a((v)localObject, localv2, arrayOfDouble1);
                      bool1 |= bool2;
                    }
                  }
                }
                localObject = localv1;
                arrayOfDouble1[0] = arrayOfDouble2[0];
                arrayOfDouble1[1] = arrayOfDouble2[1];
                if (j != 0) {
                  break label304;
                }
                if (i == 0) {}
              }
              else
              {
                arrayOfDouble1[0] = arrayOfDouble3[0];
                arrayOfDouble1[1] = arrayOfDouble3[1];
              }
              localv1 = localv1.a();
              if (i == 0) {
                break;
              }
              bool2 |= a((v)localObject, localbb.g(), arrayOfDouble1);
            } while (j != 0);
            bool1 |= bool2;
            localy.f();
          }
        } while (i == 0);
      } while (j != 0);
      if (bool2) {
        break;
      }
      this.B.c();
    } while ((j != 0) || (i != 0));
    label304:
    label333:
    label346:
    return bool1;
  }
  
  protected z h()
  {
    int j = f.o;
    int i = f.n;
    this.C.c();
    x localx = db.a(new Object[this.l.k()]);
    z localz = new z();
    w localw = this.l.v();
    label145:
    label250:
    label251:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      if (i != 0) {
        return localz;
      }
      for (;;)
      {
        if (localx.get(locale) == null)
        {
          if (j != 0) {
            break label269;
          }
          if (p(locale))
          {
            do
            {
              if (locale.d() != 1) {
                break label145;
              }
              if (i != 0) {
                break;
              }
              if (!p(locale.p().d())) {
                break label145;
              }
              locale = locale.p().d();
            } while (i == 0);
            bb localbb = new bb();
            localbb.add(locale);
            if (j == 0)
            {
              localx.a(locale, localbb);
              do
              {
                if (locale.e() != 1) {
                  break;
                }
                locale = locale.q().d();
                if (j != 0) {
                  break label251;
                }
                if (i != 0) {
                  break label250;
                }
                if (!p(locale)) {
                  break;
                }
                localbb.add(locale);
                localx.a(locale, localbb);
              } while (i == 0);
              if (j != 0) {
                break label285;
              }
              if (localbb.size() > 1) {
                localz.add(localbb);
              }
            }
          }
        }
      }
      localw.f();
    } while (i == 0);
    label269:
    if (j == 0) {
      this.C.c();
    }
    label285:
    return localz;
  }
  
  protected boolean a(v paramv1, v paramv2, double[] paramArrayOfDouble)
  {
    int j = f.o;
    int i = f.n;
    this.D.c();
    boolean bool = false;
    if (j == 0) {
      if (paramv1 == paramv2)
      {
        this.D.c();
        return false;
      }
    }
    e locale1 = (e)paramv1.c();
    e locale2 = (e)paramv2.c();
    double d1 = (paramArrayOfDouble[0] + paramArrayOfDouble[1]) / 2.0D;
    double d2;
    if (j == 0)
    {
      if (paramArrayOfDouble[0] <= -1.797693134862316E+308D)
      {
        paramArrayOfDouble[0] = Math.min(this.l.m(locale1), this.l.m(locale2));
        d2 = paramArrayOfDouble[0];
        if (j == 0)
        {
          if (locale1.d() == 1) {
            d2 = Math.min(d2, this.l.m(locale1.p().d()));
          }
          if (j != 0) {}
        }
        else
        {
          if (locale2.e() == 1) {
            d2 = Math.min(d2, this.l.m(locale2.q().d()));
          }
          paramArrayOfDouble[0] = d2;
          if (j != 0) {
            break label219;
          }
        }
        if (paramArrayOfDouble[0] > paramArrayOfDouble[1]) {
          paramArrayOfDouble[0] = paramArrayOfDouble[1];
        }
        label219:
        d1 = paramArrayOfDouble[0];
      }
      if (j != 0) {}
    }
    else if (paramArrayOfDouble[1] >= 1.7976931348623157E+308D)
    {
      paramArrayOfDouble[1] = Math.max(this.l.m(locale1), this.l.m(locale2));
      d2 = paramArrayOfDouble[1];
      if (j == 0)
      {
        if (locale1.d() == 1) {
          d2 = Math.max(d2, this.l.m(locale1.p().d()));
        }
        if (j != 0) {}
      }
      else
      {
        if (locale2.e() == 1) {
          d2 = Math.max(d2, this.l.m(locale2.q().d()));
        }
        paramArrayOfDouble[1] = d2;
        if (j != 0) {
          break label370;
        }
      }
      if (paramArrayOfDouble[1] < paramArrayOfDouble[0]) {
        paramArrayOfDouble[1] = paramArrayOfDouble[0];
      }
      label370:
      d1 = paramArrayOfDouble[1];
      break label441;
    }
    e locale3 = (e)paramv1.c();
    label422:
    label441:
    do
    {
      if (!bool)
      {
        if (j != 0) {
          break label422;
        }
        if (Math.abs(this.l.m(locale3) - d1) > 5.0D) {
          bool = true;
        }
      }
      this.l.a(locale3, d1, this.l.n(locale3));
      do
      {
        paramv1 = paramv1.a();
        if (paramv1 != paramv2.a()) {
          break;
        }
        this.D.c();
      } while (j != 0);
      if (i != 0) {
        break;
      }
    } while (j != 0);
    return bool;
  }
  
  protected boolean p(e parame)
  {
    int i = f.o;
    if (i == 0)
    {
      if (parame.d() == 1)
      {
        if (i == 0) {}
        return parame.e() < 2;
      }
      if (i != 0) {}
    }
    else if (parame.e() == 1)
    {
      if (i == 0) {}
      return parame.d() < 2;
    }
    return false;
  }
  
  protected void i()
  {
    int k = f.o;
    int j = f.n;
    this.E.c();
    bb localbb = new bb(this.l.v());
    boolean[] arrayOfBoolean = new boolean[this.l.k()];
    int i = 0;
    break label147;
    label44:
    if (!localbb.isEmpty()) {
      label48:
      label52:
      if (i < this.l.k() * this.l.k()) {
        i++;
      }
    }
    label147:
    while (k != 0)
    {
      e locale = localbb.o();
      arrayOfBoolean[locale.f()] = true;
      double d = a(locale, locale.l());
      d = a(locale, d);
      if (Math.abs(d) <= 1.E-005D) {
        break label44;
      }
      b(locale, d);
      if (k != 0) {
        break label52;
      }
      if (j != 0) {
        return;
      }
      w localw = locale.o();
      if (!localw.e()) {
        break label44;
      }
      if (j != 0) {
        break label48;
      }
      if (arrayOfBoolean[localw.d().f()] != 0)
      {
        arrayOfBoolean[localw.d().f()] = false;
        localbb.b(localw.d());
      }
      localw.f();
      if (j == 0) {
        break;
      }
    }
    this.E.c();
  }
  
  protected void a(z paramz, int paramInt)
  {
    int j = f.o;
    int i = f.n;
    this.F.c();
    y localy = paramz.h();
    if (localy.e()) {}
    label137:
    label145:
    while (j != 0)
    {
      bb localbb = (bb)localy.j();
      double d = a(localbb.h(), paramInt);
      if (j == 0)
      {
        if (i != 0) {
          return;
        }
        if (j != 0) {}
      }
      else if (d < 0.0D)
      {
        d = a(localbb.m(), d);
        a(localbb.h(), d);
        if (j != 0) {
          break label145;
        }
        if (i == 0) {
          break label137;
        }
      }
      d = a((e)localbb.d(), d);
      a(localbb.h(), d);
      localy.f();
      if (i == 0) {
        break;
      }
    }
    this.F.c();
  }
  
  protected z a(bb parambb, int paramInt)
  {
    int k = f.o;
    int j = f.n;
    this.G.c();
    z localz = new z();
    w localw = parambb.l();
    do
    {
      if (!localw.e()) {
        break;
      }
      localObject1 = new bb();
      ((bb)localObject1).add(localw.d());
      if (k == 0)
      {
        if (j != 0) {
          break label93;
        }
        localz.add(localObject1);
        localw.f();
      }
    } while (j == 0);
    label93:
    int i = 0;
    i = 0;
    Object localObject1 = localz.f();
    label104:
    if (localObject1 != null) {}
    do
    {
      bb localbb1 = (bb)((v)localObject1).c();
      localObject1 = ((v)localObject1).a();
      if (localObject1 == null) {
        break label104;
      }
      bb localbb2 = (bb)((v)localObject1).c();
      if ((k == 0) && (j == 0))
      {
        if (!a((e)localbb1.d(), localbb2.m())) {
          break label104;
        }
        double d1 = a(localbb1.h(), paramInt);
        double d2 = a(localbb2.h(), paramInt);
        if ((k == 0) && (d1 < d2)) {
          break label104;
        }
        i = 1;
        localbb1.a(localbb2.h());
        Object localObject2 = localObject1;
        localz.h(localObject2);
        localObject1 = ((v)localObject1).a();
        if (j == 0) {
          break label104;
        }
      }
      if (i != 0) {
        break;
      }
      this.G.c();
    } while ((k != 0) || (j != 0));
    return localz;
  }
  
  protected void a(o paramo)
  {
    this.l = paramo;
  }
  
  protected double a(e parame, m paramm)
  {
    int j = f.o;
    int i = f.n;
    double d1 = 0.0D;
    double d2 = 0.0D;
    paramm.h();
    do
    {
      do
      {
        if (!paramm.e()) {
          break;
        }
        d locald = paramm.a();
        double d3 = a(locald);
        d2 += d3;
        if (j != 0) {
          break label124;
        }
        d1 += d3 * (this.l.m(locald.a(parame)) - this.l.m(parame));
        paramm.f();
        if (i != 0) {
          break label120;
        }
      } while (i == 0);
      if (j != 0) {
        break label123;
      }
    } while (j != 0);
    if (d1 == 0.0D) {
      return 0.0D;
    }
    label120:
    label123:
    label124:
    return d1 / d2;
  }
  
  protected boolean a(e parame1, e parame2)
  {
    int i = f.o;
    if (i == 0) {
      if (this.w.get(parame1) == parame2)
      {
        if (i == 0) {}
        return a(parame2) - b(parame1) - 1.E-005D < b(parame1, false);
      }
    }
    if ((i != 0) || (this.x.get(parame1) == parame2))
    {
      if (i == 0) {}
      return a(parame1) - b(parame2) - 1.E-005D < b(parame1, true);
    }
    return false;
  }
  
  protected double a(e parame, double paramDouble)
  {
    int i = f.o;
    this.I.c();
    if (i == 0)
    {
      if (paramDouble != 0.0D)
      {
        e locale;
        if (paramDouble < 0.0D)
        {
          locale = (e)this.x.get(parame);
          if (i != 0) {
            return paramDouble;
          }
          if (locale != null)
          {
            paramDouble = Math.max(paramDouble, b(locale) - a(parame) + b(parame, true));
            if (i != 0) {
              return paramDouble;
            }
            if (f.n == 0) {}
          }
        }
        else
        {
          locale = (e)this.w.get(parame);
          if (i != 0) {
            return paramDouble;
          }
          if (locale != null) {
            paramDouble = Math.min(paramDouble, a(locale) - b(parame) - b(parame, false));
          }
        }
      }
      this.I.c();
    }
    return paramDouble;
  }
  
  protected double a(y paramy, int paramInt)
  {
    int k = f.o;
    int j = f.n;
    this.H.c();
    int i = 0;
    double d = 0.0D;
    paramy.h();
    if (paramy.e()) {
      i++;
    }
    label148:
    label156:
    while (k != 0)
    {
      e locale = (e)paramy.j();
      if ((k == 0) && (j != 0)) {
        break label171;
      }
      if (k == 0) {
        if (paramInt == -1)
        {
          d += a(locale, locale.m());
          if (k != 0) {
            break label156;
          }
          if (j == 0) {
            break label148;
          }
        }
      }
      if (k == 0)
      {
        if (paramInt == 0) {
          d += a(locale, locale.l());
        }
      }
      else
      {
        if (k != 0) {
          break label156;
        }
        if (j == 0) {
          break label148;
        }
      }
      d += a(locale, locale.n());
      paramy.f();
      if (j == 0) {
        break;
      }
    }
    this.H.c();
    label171:
    return d / i;
  }
  
  protected void b(e parame, double paramDouble)
  {
    int i = f.o;
    double d = this.l.m(parame) + paramDouble;
    if (i == 0) {
      if (this.q) {
        if (this.j.get(parame) == null)
        {
          d = (int)((d + this.s / 2.0D) / this.s) * this.s;
          if (i != 0) {
            return;
          }
          if (f.n == 0) {}
        }
        else
        {
          d = (int)((d + this.r / 2.0D) / this.r) * this.r;
        }
      }
    }
    this.l.a(parame, d, this.l.n(parame));
  }
  
  protected void a(y paramy, double paramDouble)
  {
    int i = f.n;
    paramy.h();
    do
    {
      if (!paramy.e()) {
        break;
      }
      e locale = (e)paramy.j();
      b(locale, paramDouble);
      paramy.f();
    } while (i == 0);
  }
  
  protected double j()
  {
    int j = f.o;
    int i = f.n;
    this.J.c();
    double d = 0.0D;
    w localw = this.l.v();
    label137:
    label139:
    do
    {
      do
      {
        if (!localw.e()) {
          break label142;
        }
        m localm = localw.d().l();
        do
        {
          if (!localm.e()) {
            break;
          }
          d locald = localm.a();
          d += a(locald) * Math.abs(this.l.m(locald.e()) - this.l.m(locald.f()));
          localm.f();
          if (j != 0) {
            break label139;
          }
          if (i != 0) {
            break label137;
          }
        } while (i == 0);
      } while (j != 0);
      localw.f();
    } while (i == 0);
    label142:
    this.J.c();
    return d;
  }
  
  protected double a(d paramd)
  {
    int i = f.o;
    if (i == 0)
    {
      if (this.j.get(paramd.e()) == null)
      {
        if (i == 0) {
          if (this.j.get(paramd.f()) == null) {
            return 1.0D;
          }
        }
        return this.u * 1.0D;
      }
      if (i != 0) {}
    }
    else if (this.j.get(paramd.f()) == null)
    {
      return this.u * 1.0D;
    }
    return this.t * 1.0D;
  }
  
  protected double a(e parame, boolean paramBoolean)
  {
    if (paramBoolean)
    {
      locale = (e)this.x.get(parame);
      if (locale == null) {
        return -1.797693134862316E+308D;
      }
      return b(locale) + b(parame, true) + k(parame);
    }
    e locale = (e)this.w.get(parame);
    if (locale == null) {
      return 1.7976931348623157E+308D;
    }
    return a(locale) - b(parame, false) - l(parame);
  }
  
  protected double b(e parame, boolean paramBoolean)
  {
    int i = f.o;
    if (paramBoolean)
    {
      if (i == 0) {
        if (this.x.get(parame) == null) {
          return 0.0D;
        }
      }
      if (i != 0) {
        break label64;
      }
      locale = (e)this.x.get(parame);
      if (f.n == 0) {
        break label88;
      }
    }
    label64:
    if (i == 0) {
      if (this.w.get(parame) == null) {
        return 0.0D;
      }
    }
    e locale = (e)this.w.get(parame);
    label88:
    d locald1 = (d)this.j.get(parame);
    d locald2 = (d)this.j.get(locale);
    if ((i != 0) || (locald1 != null))
    {
      if (i != 0) {
        break label145;
      }
      if (locald2 != null) {}
    }
    else
    {
      return c();
    }
    label145:
    if ((i != 0) || ((locald1.f() == locald2.e()) || (locald1.f() == locald2.f()))) {
      return b();
    }
    return a();
  }
  
  protected void b(bb[] paramArrayOfbb)
  {
    int k = f.o;
    int j = f.n;
    this.K.c();
    a(this.l, paramArrayOfbb);
    int i = 0;
    label306:
    label308:
    do
    {
      if (i >= paramArrayOfbb.length) {
        break;
      }
      double d = 0.0D;
      Object localObject = null;
      if (j != 0) {
        return;
      }
      w localw = paramArrayOfbb[i].l();
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        if (k != 0) {
          break label308;
        }
        if (j != 0) {
          break label306;
        }
        if (k == 0) {
          if (localObject != null)
          {
            this.w.a(localObject, locale);
            this.x.a(locale, localObject);
          }
        }
        localObject = locale;
        d += this.l.d(locale).c() / 2.0D + g(locale) + b(locale, true);
        if (k == 0)
        {
          if (this.q) {
            if (this.j.get(locale) == null)
            {
              d = (int)((d + this.s / 2.0D) / this.s) * this.s;
              if (k != 0) {
                continue;
              }
              if (j == 0) {}
            }
            else
            {
              d = (int)((d + this.r / 2.0D) / this.r) * this.r;
            }
          }
          this.l.a(locale, d, this.l.n(locale));
          d += this.l.d(locale).c() / 2.0D + h(locale);
          localw.f();
        }
      } while (j == 0);
      if (k == 0) {
        i++;
      }
    } while (j == 0);
    if (k == 0) {
      this.K.c();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.i

 * JD-Core Version:    0.7.0.1

 */